#include "Stack.h"

Stack::Stack() {size_ = 0;first = nullptr;}

Stack::~Stack() {}

ChessNode* Stack::pop()
{
    if(size_>0)
    {
        StackNode* temp = first;
        first = first->next;
        size_--;
        return temp->value;
    }
    else
        return nullptr;

}

void Stack::push(ChessNode *p)
{
    StackNode* temp = new StackNode(p);
    temp->next = first;
    first = temp;
    size_++;
}

bool Stack::isempty()
{
    return size_==0;
}
